package wrapper;

import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.csvreader.CsvReader;

/**
 * @author Or Kaplan
 * define an interface for db field manager, takes care for type specific field
 */
public interface IFieldWrapper {
	
	/**
	 * @return the name of the field on the TSV file
	 */
	String getTsvFieldName();
	
	/**
	 * @return the name of the field on the data base
	 */
	String getTableFieldName();
	
	/**
	 * insert a field to statement after reading the content from the TSV file
	 * @param statement
	 * @param position
	 * @param reader
	 * @return is success
	 * @throws IOException
	 * @throws SQLException
	 */
	boolean insertToStatement(PreparedStatement statement, int position, CsvReader reader) throws IOException, SQLException;
	
	/**
	 * insert a field to statement from a list of values
	 * @param statement
	 * @param position
	 * @param value
	 * @return is success
	 * @throws SQLException
	 */
	boolean insertToStatement(PreparedStatement statement, int position, String value) throws SQLException;
	
	/**
	 * validate a data against a field
	 * @param data
	 * @return is valid
	 */
	boolean Validate(String data);
}
